<?php

use yii\db\Migration;

/**
 * Class m191009_061105_project_type
 */
class m191009_061105_project_type extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="项目类型表"';
        $this->createTable('{{%project_type}}', [
            'id' => $this->primaryKey(),
            'title'=>$this->string()->notNull()->comment('名称'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('分类状态 1:启用 2:停用 3:删除'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%project_type}}');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m191009_061105_project_type cannot be reverted.\n";

        return false;
    }
    */
}
